//
//  XDProductsIntroduceView.m
//  xindailianmeng
//
//  Created by 张东 on 2017/2/9.
//  Copyright © 2017年 xindailianmeng.cn. All rights reserved.
//

#import "XDProductsIntroduceView.h"
#import "XDMyInvestmentModel.h"
#import "ZHRTBasicMethod.h"
@interface XDProductsIntroduceView ()
@property (weak, nonatomic) IBOutlet UILabel *nameLb;

@property (weak, nonatomic) IBOutlet UILabel *yearRateLb;
@property (weak, nonatomic) IBOutlet UILabel *limitLb;
@property (weak, nonatomic) IBOutlet UILabel *inMoneyLb;
@property (weak, nonatomic) IBOutlet UILabel *inTimeLb;
@property (weak, nonatomic) IBOutlet UILabel *payTimeLb;
@property (weak, nonatomic) IBOutlet UILabel *interestTypeLb;
@property (weak, nonatomic) IBOutlet UILabel *paybackTypeLb;
@property (weak, nonatomic) IBOutlet UILabel *safeWayLb;

@end

@implementation XDProductsIntroduceView

- (void)setModel:(XDMyInvestmentModel *)model {
    
    _model = model;
    if (_model.isMulti == 1) {
        self.nameLb.text = [NSString stringWithFormat:@"%@%@", _model.name, _model.postNumber];
    } else {
        self.nameLb.text = _model.name;
    }
    NSString *str = [NSString stringWithFormat:@"%@%%",[ZHRTBasicMethod effectiveFigure: _model.yearRate]];
    NSMutableAttributedString *yearRateStr = [[NSMutableAttributedString alloc] initWithString:str ];
    [yearRateStr addAttribute:NSFontAttributeName value:kBaseFont_(20) range:[str rangeOfString:@"%"]];
    self.yearRateLb.attributedText = yearRateStr;
    
    if ([_model.limitType isEqualToString:@"月"]) {
        self.limitLb.text = [NSString stringWithFormat:@"%zd个%@", _model.limitTime, _model.limitType];
    } else {
        self.limitLb.text = [NSString stringWithFormat:@"%zd%@", _model.limitTime, _model.limitType];
    }
    self.inMoneyLb.text = [ZHRTBasicMethod ChangeNumberFormat:[NSString stringWithFormat:@"%.2f", model.inMoney]];
    self.inTimeLb.text = _model.inTime;
    self.payTimeLb.text = _model.payBackTime;
    
    self.interestTypeLb.text = _model.interestType;
    self.paybackTypeLb.text = _model.paybackType;
    self.safeWayLb.text = _model.safeWay;
}

@end
